<template>
  <div class="expert-library-management">
    <!-- 查询区 -->
    <el-form :inline="true" :model="queryForm" class="filter-form">
      <el-form-item label="专家姓名">
        <el-input v-model="queryForm.name" placeholder="请输入"></el-input>
      </el-form-item>
      <el-form-item label="职位">
        <el-select v-model="queryForm.position" placeholder="请选择">
          <el-option label="主任" value="主任"/>
          <el-option label="工程师" value="工程师"/>
          <!-- 其他选项 -->
        </el-select>
      </el-form-item>
      <el-form-item label="专业">
        <el-select v-model="queryForm.major" placeholder="请选择">
          <el-option label="水资源" value="水资源"/>
          <!-- 其他选项 -->
        </el-select>
      </el-form-item>
      <el-form-item label="性别">
        <el-select v-model="queryForm.gender" placeholder="请选择">
          <el-option label="男" value="男"/>
          <el-option label="女" value="女"/>
        </el-select>
      </el-form-item>
      <el-form-item label="年龄">
        <el-input v-model="queryForm.ageStart" placeholder="起始" style="width: 80px;"/> -
        <el-input v-model="queryForm.ageEnd" placeholder="结束" style="width: 80px;"/>
      </el-form-item>
      <el-form-item>
        <el-button @click="resetQuery">清空</el-button>
        <el-button type="primary" @click="queryExperts">搜索</el-button>
      </el-form-item>
    </el-form>

    <!-- 操作按钮区 -->
    <div class="btn-group" style="margin: 20px 0;">
      <el-button type="success" @click="addExpert">新增</el-button>
      <el-button type="danger" @click="deleteExperts">删除</el-button>
      <el-button type="primary" @click="exportExperts">导出</el-button>
      <el-button type="primary" @click="reviewExperts">审核</el-button>
      <el-button type="primary" @click="inLibrary">入库</el-button>
    </div>

    <!-- 专家列表表格 -->
    <el-table :data="expertList" border style="width: 100%;" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="50"/>
      <el-table-column type="index" label="序号" width="60"/>
      <el-table-column prop="name" label="专家姓名" min-width="100"/>
      <el-table-column prop="reviewStatus" label="审核状态" min-width="100">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.reviewStatus==='已审核入库'" type="success">已审核入库</el-tag>
          <el-tag v-else-if="scope.row.reviewStatus==='审核不通过'" type="danger">审核不通过</el-tag>
          <el-tag v-else type="info">未审核</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="reviewDept" label="审核处室" min-width="100"/>
      <el-table-column prop="gender" label="性别" min-width="60"/>
      <el-table-column prop="age" label="年龄" min-width="60"/>
      <el-table-column prop="position" label="职位" min-width="80"/>
      <el-table-column prop="major" label="专业(主专业)" min-width="120"/>
      <el-table-column prop="education" label="学历" min-width="80"/>
      <el-table-column prop="title" label="职称" min-width="100"/>
      <el-table-column prop="company" label="单位" min-width="120"/>
      <!-- <el-table-column prop="entryTime" label="入库时间" min-width="120"/> -->
      <el-table-column prop="reviewCount" label="参与评审会次数" min-width="120"/>
      <el-table-column prop="projectChangeCount" label="参与项目出现变更次数" min-width="160"/>
      <el-table-column label="操作" min-width="120">
        <template slot-scope="scope">
          <el-link @click="handleView(scope.row)">查看</el-link>
          <el-link @click="handleEdit(scope.row)" style="margin-left: 10px;">编辑</el-link>
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页 -->
    <div style="margin: 20px 0; text-align: right;">
      <el-pagination
        background
        layout="total, sizes, prev, pager, next, jumper"
        :total="expertList.length"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="10"
        :current-page="1"
      />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryForm: {
        name: '',
        position: '',
        major: '',
        gender: '',
        ageStart: '',
        ageEnd: ''
      },
      expertList: [
        {
          name: '张三', reviewStatus: '已审核入库', reviewDept: '建监处', gender: '男', age: 45, position: '主任', major: '智查检察 > 建设管理', education: '博士研究生', title: '正高级职称', company: '西安科技大学', entryTime: '2025-05-10', reviewCount: 5, projectChangeCount: 2
        },
        {
          name: '李四', reviewStatus: '审核不通过', reviewDept: '水保处', gender: '女', age: 32, position: '工程师', major: '水资源', education: '硕士研究生', title: '副高级职称', company: '西安理工大学', entryTime: '2025-05-01', reviewCount: 3, projectChangeCount: 1
        },
        // ...更多模拟数据
      ],
      selectedRows: []
    }
  },
  methods: {
    queryExperts() {
      // 查询逻辑
    },
    resetQuery() {
      this.queryForm = { name: '', position: '', major: '', gender: '', ageStart: '', ageEnd: '' }
    },
    addExpert() {},
    deleteExperts() {},
    exportExperts() {},
    reviewExperts() {},
    inLibrary() {},
    handleView(row) {},
    handleEdit(row) {},
    handleSelectionChange(val) {
      this.selectedRows = val
    }
  }
}
</script>

<style lang="less" scoped>
.expert-library-management {
  padding: 20px;
  .filter-form {
    margin-bottom: 10px;
  }
  .btn-group {
    button {
      margin-right: 10px;
    }
  }
}
</style>
